//
//  WLRouterDeviceController.m
//  WanLian
//
//  Created by muzhuang on 2018/10/17.
//  Copyright © 2018年 wanlian. All rights reserved.
//

#import "WLRouterDeviceController.h"
#import "WLDeviceDetailCell.h"
//#import "WLAlertView.h"

@interface WLRouterDeviceController ()<UITableViewDelegate,UITableViewDataSource>//,RouterSocketDelegate>
{
    UILabel *labUpValue;
    UILabel *labDownValue;
}

@property (nonatomic, strong) UITableView   *tbDeviceInfo;
@property (nonatomic, assign) BOOL  isOpen;
@property (nonatomic, assign) BOOL  isBlack;
@property (nonatomic, strong) NSMutableDictionary *dictLimit;

@end

@implementation WLRouterDeviceController

- (void)dealloc
{
//    [[WLSocketManager sharedSocketManager] removeDelegate:self];
    [[WLSocketManager sharedSocketManager] removeDelegate:self delegateQueue:dispatch_get_main_queue()];
}

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    [self receiveDeviceLimitSpeed];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.fd_interactivePopDisabled = YES;
    
    self.navigationController.interactivePopGestureRecognizer.enabled = YES;
    self.navigationController.interactivePopGestureRecognizer.delegate = (id)self;
    self.title = @"设备详情";
    _dictLimit = [[NSMutableDictionary alloc] initWithCapacity:2];
    _tbDeviceInfo = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
    _tbDeviceInfo.backgroundColor = wlUIColorRGB(0xFAFAFA);;
    _tbDeviceInfo.delegate = self;
    _tbDeviceInfo.dataSource = self;
    if (@available(iOS 11.0, *)) {
        _tbDeviceInfo.estimatedSectionHeaderHeight = 0;
        _tbDeviceInfo.estimatedSectionFooterHeight = 0;
    }
    [self.view addSubview:_tbDeviceInfo];
    _tbDeviceInfo.scrollEnabled = NO;
    WLWkSelf
    [_tbDeviceInfo mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(weakSelf.view);
    }];
    
//    [[WLSocketManager sharedSocketManager] addDelegate:self];
    [[WLSocketManager sharedSocketManager] addDelegate:self delegateQueue:dispatch_get_main_queue()];
    [self receiveRouterInformation];
}

- (void)receiveRouterInformation
{
    NSDictionary *dict = @{@"type":@"DEVICE_LOADING_REQ",@"content":@""};
    [[WLSocketManager sharedSocketManager] sendMessage:dict timeOut:-1 tag:0];
}

- (void)receiveDeviceLimitSpeed
{
    NSDictionary *paramDevice = @{@"macAddress":self.deviceModel.macAddress,@"ip":self.deviceModel.ip};
    NSError *parseError;
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:paramDevice options:NSJSONWritingPrettyPrinted error:&parseError];
    NSString *strContent = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
    
    NSDictionary *dict = @{@"type":@"DEVICE_LIMITSPEED_REQ",@"content":strContent};
    [[WLSocketManager sharedSocketManager] sendMessage:dict timeOut:-1 tag:0];
}

#pragma mark - 接收消息代理
- (void)didReceiveMessage:(WLSocketModel *)msgModel withTag:(long)tag
{
    if ([msgModel.type isEqualToString:@"DEVICE_LOADING_REP"])
    {
        if (msgModel.content != nil) {
            NSData *jsonData = [msgModel.content dataUsingEncoding:NSUTF8StringEncoding];
            NSError *err;
            NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:jsonData
                                                                options:NSJSONReadingMutableContainers
                                                                  error:&err];
            _isBlack = [dic[@"blackStatus"] boolValue];
            [_tbDeviceInfo reloadData];
        }
    }
    else if ([msgModel.type isEqualToString:@"DEVICE_LIMITSPEED_RSP"])
    {
        if (msgModel.content != nil) {
            NSData *jsonData = [msgModel.content dataUsingEncoding:NSUTF8StringEncoding];
            NSError *err;
            NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:jsonData
                                                                options:NSJSONReadingMutableContainers
                                                                  error:&err];
            [self.dictLimit setDictionary:dic];
        }
    }
    else if ([msgModel.type isEqualToString:@"COMMON_SUCCESS"])
    {
        [self showHUDMessage:@"设置成功"];
//        if ([msgModel.replyType isEqualToString:@"DEVICE_LIMITSPEED_SET"]) {
//            [self receiveDeviceLimitSpeed];
//        }
    }
}

#pragma mark - UITableView
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 3;
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return WLScaleX(20);
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    return 0.01;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    if (section==0) {
        return 1;
    }
    else if (section==2)
    {
        if (_isBlack)
        {
//            if (self.deviceModel.access) {
//                return 2;
//            }
            return 2;
        }
        return 1;
    }
    return 2;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.section==0) {
        return WLScaleX(144);
    }
    else if (indexPath.section==2)//&&self.isOpen==YES)
    {
        if (indexPath.row==0) {
            if (self.isOpen==YES) {
                return WLScaleX(128);
            }
        }
        return WLScaleX(58);
    }
    else
    {
        return WLScaleX(58);
    }
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSInteger section = indexPath.section;
    NSInteger row = indexPath.row;
    static NSString *strInfo = @"infoCell";
    WLDeviceDetailCell *cell = [tableView dequeueReusableCellWithIdentifier:strInfo];
    if (!cell) {
        cell = [[WLDeviceDetailCell alloc] initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:strInfo];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    cell.accessoryView = nil;
    
    if (section==0)
    {
        static NSString *strDevice = @"deviceInfo";
        UITableViewCell *deviceCell = [tableView dequeueReusableCellWithIdentifier:strDevice];
        if (!deviceCell) {
            deviceCell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:strDevice];
            deviceCell.selectionStyle = UITableViewCellSelectionStyleNone;
        }
        for (UIView *subView in deviceCell.contentView.subviews) {
            [subView removeFromSuperview];
        }
        UIImageView *ivHead = [[UIImageView alloc] initWithFrame:CGRectMake((WIDTH_SCREEN_WL-46)/2.0, WLScaleX(18), 46, 38)];
        ivHead.image = [UIImage imageNamed:@"router_device"];
        [deviceCell.contentView addSubview:ivHead];
        
        UILabel *labName = [[UILabel alloc] init];
        labName.textAlignment = NSTextAlignmentRight;
        labName.textColor = wlBlackColor;
        labName.font = [WLCommonTool fontTypePingFangSCMedium:17];
        labName.text = _deviceModel.name;
        [deviceCell.contentView addSubview:labName];
        
        UILabel *labStatus = [[UILabel alloc] init];
        labStatus.textColor = wlGreenColor;
        labStatus.font = [WLCommonTool fontTypePingFangSCMedium:12];
        labStatus.text = @"在线";
        [deviceCell.contentView addSubview:labStatus];
        
        UILabel *labUp = [[UILabel alloc] initWithFrame:CGRectMake(WLScaleX(16), WLScaleX(18+10)+38+2+30, WIDTH_SCREEN_WL/2.0-WLScaleX(16+10), 20)];
        labUp.textColor = wlDarkGrayColor;
        labUp.font = [WLCommonTool fontTypePingFangSCRegular:11];
        labUp.textAlignment = NSTextAlignmentRight;
        [deviceCell.contentView addSubview:labUp];
        
        float upSpeed = [_deviceModel.upAndDownSize.up integerValue]/1024.0;
        NSString *strUp = [NSString stringWithFormat:@"上传速度：%.2fKb/s",upSpeed];
        if (upSpeed>1024)
        {
            strUp = [NSString stringWithFormat:@"上传速度：%.2fMb/s",upSpeed/1024.0];
        }
        NSMutableAttributedString *strAttrUp = [[NSMutableAttributedString alloc] initWithString:strUp];
        [strAttrUp addAttribute:NSFontAttributeName
                          value:[WLCommonTool fontTypePingFangSCMedium:14]
                          range:NSMakeRange(5, strUp.length-5)];
        labUp.attributedText = strAttrUp;
        
        UILabel *labDown = [[UILabel alloc] initWithFrame:CGRectMake(WIDTH_SCREEN_WL/2.0+WLScaleX(10), WLScaleX(18+10)+38+2+30, WIDTH_SCREEN_WL/2.0-WLScaleX(16+10), 20)];
        labDown.textColor = wlDarkGrayColor;
        labDown.font = [WLCommonTool fontTypePingFangSCRegular:11];
        [deviceCell.contentView addSubview:labDown];
        
        float downSpeed = [_deviceModel.upAndDownSize.down integerValue]/1024.0;
        NSString *strDown = [NSString stringWithFormat:@"下载速度：%.2fKb/s",downSpeed];
        if (downSpeed>1024)
        {
            strDown = [NSString stringWithFormat:@"下载速度：%.2fKb/s",downSpeed/1024.0];
        }
//        else
//        {
//            strDown = [NSString stringWithFormat:@"下载速度：%.2fKb/s",_deviceModel.upAndDownSize.down];
//        }
        
        NSMutableAttributedString *strAttrDown = [[NSMutableAttributedString alloc] initWithString:strDown];
        [strAttrDown addAttribute:NSFontAttributeName
                          value:[WLCommonTool fontTypePingFangSCMedium:14]
                          range:NSMakeRange(5, strDown.length-5)];
        labDown.attributedText = strAttrDown;
        
        [labName mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(deviceCell.contentView.mas_centerX).offset(-(10+WLScaleX(5)));
            make.top.equalTo(ivHead.mas_bottom).offset(2);
            make.right.equalTo(labStatus.mas_left).offset(-WLScaleX(10));
            make.height.equalTo(@30);
        }];
        [labStatus mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(ivHead.mas_bottom).offset(2);
            make.left.equalTo(labName.mas_right).offset(WLScaleX(10));
            make.height.equalTo(@30);
        }];
        
        return deviceCell;
    }
    else if (section==2)
    {
        cell.labDetail.text = nil;
        if (row==0)
        {
            if (self.isOpen)
            {
                cell.labTitle.text = nil;
                static NSString *strSpeed = @"speedCell";
                UITableViewCell *speedCell = [tableView dequeueReusableCellWithIdentifier:strSpeed];
                if (!speedCell) {
                    speedCell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:strSpeed];
                    speedCell.selectionStyle = UITableViewCellSelectionStyleNone;
                }
                for (UIView *subView in speedCell.contentView.subviews) {
                    [subView removeFromSuperview];
                }
                
                UILabel *labTitle = [[UILabel alloc] initWithFrame:CGRectMake(WLScaleX(16), WLScaleX(14), 90, WLScaleX(30))];
                labTitle.font = [WLCommonTool fontTypePingFangSCRegular:17];
                labTitle.textColor = wlBlackColor;
                labTitle.text = @"设备限速";
                [speedCell.contentView addSubview:labTitle];
                
                UIImageView *upImageView = [[UIImageView alloc]initWithFrame:CGRectMake(WIDTH_SCREEN_WL-WLScaleX(16)-14, (WLScaleX(56)-9)/2.0, 14, 9)];
                upImageView.image = [UIImage imageNamed:@"arrow_up"];
                [speedCell.contentView addSubview:upImageView];
                
                UIButton *btnClose = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, WIDTH_SCREEN_WL, WLScaleX(58))];
                btnClose.backgroundColor = [UIColor clearColor];
                [btnClose addTarget:self action:@selector(closeTableviewCellAction) forControlEvents:UIControlEventTouchUpInside];
                [speedCell.contentView addSubview:btnClose];
                
                UILabel *labUpspeed = [[UILabel alloc] initWithFrame:CGRectMake(WLScaleX(16), WLScaleX(58), 60, 20)];
                labUpspeed.font = [WLCommonTool fontTypePingFangSCRegular:14];
                labUpspeed.textColor = wlDarkGrayColor;
                labUpspeed.text = @"上传速度";
                [speedCell.contentView addSubview:labUpspeed];

                UISlider *upSlider = [[UISlider alloc] initWithFrame:CGRectMake(WLScaleX(16+10)+60, WLScaleX(58), WIDTH_SCREEN_WL-WLScaleX(52)-120, 20)];
                upSlider.minimumTrackTintColor = wlUIColorRGB(0x52A7F6);
                upSlider.maximumTrackTintColor = wlUnderlineColor;
                [upSlider setThumbImage:[UIImage imageNamed:@"slider_img"] forState:UIControlStateNormal];
                [upSlider addTarget:self action:@selector(pressUpSlider:) forControlEvents:UIControlEventValueChanged];
                [upSlider addTarget:self action:@selector(pressUpSliderOUT:) forControlEvents:UIControlEventTouchUpInside];
                [speedCell.contentView addSubview:upSlider];
//                [upSlider setValue:0];
                labUpValue = [[UILabel alloc] initWithFrame:CGRectMake(WIDTH_SCREEN_WL-WLScaleX(16)-60, WLScaleX(58), 60, 20)];
                labUpValue.font = [WLCommonTool fontTypePingFangSCRegular:14];
                labUpValue.textColor = wlDarkGrayColor;
//                labUpValue.text = @"不限速";
                [speedCell.contentView addSubview:labUpValue];
                
                UILabel *labDownspeed = [[UILabel alloc] initWithFrame:CGRectMake(WLScaleX(16), WLScaleX(58)+20+WLScaleX(15), 60, 20)];
                labDownspeed.font = [WLCommonTool fontTypePingFangSCRegular:14];
                labDownspeed.textColor = wlDarkGrayColor;
                labDownspeed.text = @"下载速度";
                [speedCell.contentView addSubview:labDownspeed];
                
                UISlider *downSlider = [[UISlider alloc] initWithFrame:CGRectMake(WLScaleX(16+10)+60, WLScaleX(58)+20+WLScaleX(15), WIDTH_SCREEN_WL-WLScaleX(52)-120, 20)];
                downSlider.minimumTrackTintColor = wlUIColorRGB(0x52A7F6);
                downSlider.maximumTrackTintColor = wlUnderlineColor;
                [downSlider setThumbImage:[UIImage imageNamed:@"slider_img"] forState:UIControlStateNormal];
                [downSlider addTarget:self action:@selector(pressDownSlider:) forControlEvents:UIControlEventValueChanged];
                [downSlider addTarget:self action:@selector(pressDownSliderOUT:) forControlEvents:UIControlEventTouchUpInside];
                [speedCell.contentView addSubview:downSlider];
                
                labDownValue = [[UILabel alloc] initWithFrame:CGRectMake(WIDTH_SCREEN_WL-WLScaleX(16)-60, WLScaleX(58)+20+WLScaleX(15), 60, 20)];
                labDownValue.font = [WLCommonTool fontTypePingFangSCRegular:14];
                labDownValue.textColor = wlDarkGrayColor;
//                labDownValue.text = @"不限速";
                [speedCell.contentView addSubview:labDownValue];
                if (self.dictLimit.count>0)
                {
                    int upLimit = [self.dictLimit[@"up"] intValue];
                    int downLimit = [self.dictLimit[@"down"] intValue];
                    upSlider.value = upLimit/100.0;
                    downSlider.value = downLimit/100.0;
                    if (upLimit==0) {
                        labUpValue.text = @"不限速";
                    }
                    else
                    {
                        labUpValue.text = [NSString stringWithFormat:@"%dKb/s",upLimit];
                    }
                    if (downLimit==0) {
                        labDownValue.text = @"不限速";
                    }
                    else
                    {
                        labDownValue.text = [NSString stringWithFormat:@"%dKb/s",downLimit];;
                    }
                }
                
                return speedCell;
            }
            else
            {
                cell.labTitle.text = @"设备限速";
                UIImageView *downImageView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"arrow_down"]];//Frame:CGRectMake(WIDTH_SCREEN_WL-WLScaleX(32)-14, (WLScaleX(56)-9)/2.0, 14, 9)];
                cell.accessoryView = downImageView;
            }
        }
        else if (row==1)
        {
            cell.labTitle.text = @"加入黑名单";
            UISwitch *btnSwitch = [[UISwitch alloc] initWithFrame:CGRectMake(0, 0, 40, WLScaleX(14))];
            btnSwitch.onTintColor = wlblueColor;//wlRGBACOLOR(26, 89, 226, 0.6);
//            btnSwitch.thumbTintColor = wlblueColor;
            [btnSwitch addTarget:self action:@selector(blackListAction:) forControlEvents:UIControlEventValueChanged];
            cell.accessoryView = btnSwitch;
            if (_isBlack) {
                if (!self.deviceModel.access) {
                    btnSwitch.on = YES;
                }
            }
        }
    }
    else
    {
        if (row==0) {
            cell.labTitle.text = @"MAC地址";
            cell.labDetail.text = _deviceModel.macAddress;
        }
        else
        {
            cell.labTitle.text = @"IP地址";
            cell.labDetail.text = _deviceModel.ip;
        }
    }
    
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.section==2&&indexPath.row==0&&self.isOpen==NO) {
        if (self.dictLimit.count>0) {
            self.isOpen = YES;
            [self.tbDeviceInfo reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
        }
        else
        {
            [self receiveDeviceLimitSpeed];
        }
    }
}

- (void)closeTableviewCellAction
{
    self.isOpen = NO;
    NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:2];
    [self.tbDeviceInfo reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
}

- (void)pressUpSlider:(UISlider *)upSlider
{
    if (upSlider.value==0) {
        labUpValue.text = @"不限速";
    }
    else
    {
        labUpValue.text = [NSString stringWithFormat:@"%dKb/s",(int)(upSlider.value*100)];
    }
}

- (void)pressUpSliderOUT:(UISlider *)slider
{
    int upSpeed;
    if (slider.value==0) {
//        _deviceModel.upAndDownSize.up = @"0";
        upSpeed = 0;
        labUpValue.text = @"不限速";
    }
    else
    {
        upSpeed = (int)(slider.value*100);
//        _deviceModel.upAndDownSize.up = [NSString stringWithFormat:@"%.f",(slider.value)*100];
        labUpValue.text = [NSString stringWithFormat:@"%dKb/s",upSpeed];
    }
//    NSString *dictStr = self.deviceModel.mj_JSONString;
//    NSMutableDictionary *dictBlack = model.mj_keyValues;
    NSDictionary *dictLast = @{@"macAddress":self.deviceModel.macAddress,@"ip":self.deviceModel.ip,@"upAndDownSize":@{@"up":@(upSpeed),@"down":self.dictLimit[@"down"]}};
    NSString *dictStr = dictLast.mj_JSONString;
    NSDictionary *dict = @{@"type":@"DEVICE_LIMITSPEED_SET",@"content":dictStr};
    [[WLSocketManager sharedSocketManager] sendMessage:dict timeOut:-1 tag:0];
    self.dictLimit[@"up"] = [NSNumber numberWithInt:upSpeed];
}

- (void)pressDownSlider:(UISlider *)downSlider
{
    if (downSlider.value==0) {
        labDownValue.text = @"不限速";
    }
    else
    {
        labDownValue.text = [NSString stringWithFormat:@"%dKb/s",(int)(downSlider.value*100)];
    }
}

- (void)pressDownSliderOUT:(UISlider *)downSlider
{
    int downSpeed;
    if (downSlider.value==0) {
        downSpeed = 0;
//        _deviceModel.upAndDownSize.down = @"0";
        labDownValue.text = @"不限速";
    }
    else
    {
        downSpeed = (int)(downSlider.value*100);
//        _deviceModel.upAndDownSize.down = [NSString stringWithFormat:@"%.f",(downSlider.value)*100];
        labDownValue.text = [NSString stringWithFormat:@"%dKb/s",downSpeed];
    }
    NSDictionary *dictLast = @{@"macAddress":self.deviceModel.macAddress,@"ip":self.deviceModel.ip,@"upAndDownSize":@{@"up":self.dictLimit[@"up"],@"down":@(downSpeed)}};
    NSString *dictStr = dictLast.mj_JSONString;
//    NSString *dictStr = self.deviceModel.mj_JSONString;
    NSDictionary *dict = @{@"type":@"DEVICE_LIMITSPEED_SET",@"content":dictStr};
    [[WLSocketManager sharedSocketManager] sendMessage:dict timeOut:-1 tag:0];
    self.dictLimit[@"down"] = [NSNumber numberWithInt:downSpeed];
}

- (void)blackListAction:(UISwitch *)switchBtn
{
//    if (_isBlack==NO&&switchBtn.on)
//    {
//        WLWkSelf
//        WLAlertView *alertView = [[WLAlertView alloc] initWithTitle:@"提示" message:@"防火墙已关闭，是否打开？" cancelBtnTitle:@"取消" goBtnTitle:@"打开"];
//        alertView.cancelAction = ^{
//            switchBtn.on = NO;
//        };
//        alertView.okAction = ^{
//            [weakSelf addDevieceToBlack];
//        };
//        [alertView show];
//    }
//    else
//    {
    
//        if (switchBtn.on)
//        {
//            _isBlack = switchBtn.on;
//        }
//        NSString *strContent = self.deviceModel.mj_JSONString;
        NSDictionary *dictLast = @{@"name":self.deviceModel.name,@"macAddress":self.deviceModel.macAddress};
        NSString *strContent = dictLast.mj_JSONString;
        if (switchBtn.on) {
            NSDictionary *dict = @{@"type":@"DEVICE_BLACKADD_SET",@"content":strContent};
            [[WLSocketManager sharedSocketManager] sendMessage:dict timeOut:-1 tag:0];
        }
        else
        {
            NSDictionary *dict = @{@"type":@"DEVICE_BLACKREMOVE_SET",@"content":strContent};
            [[WLSocketManager sharedSocketManager] sendMessage:dict timeOut:-1 tag:0];
        }
//    }
}

//- (void)openBlackStatus
//{
//    NSDictionary *dictParamer = @{@"bOpen":@(true)};
//    NSError *parseError;
//    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dictParamer options:NSJSONWritingPrettyPrinted error:&parseError];
//    NSString *strContent = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
//
//    NSDictionary *dict = @{@"type":@"DEVICE_BLACK_STATUS_SET",@"content":strContent};
//    [[WLSocketManager sharedSocketManager] sendMessage:dict timeOut:-1 tag:0];
//}
//
//- (void)addDevieceToBlack
//{
//    [self openBlackStatus];
//    self.isBlack = YES;
//    NSDictionary *dictLast = @{@"name":self.deviceModel.name,@"macAddress":self.deviceModel.macAddress};
//    NSString *strContent = dictLast.mj_JSONString;
//    NSDictionary *dict = @{@"type":@"DEVICE_BLACKADD_SET",@"content":strContent};
//    [[WLSocketManager sharedSocketManager] sendMessage:dict timeOut:-1 tag:0];
//}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
